#!/usr/bin/env python3

def checkpan(var_list):
    var_list = [str(x) for x in var_list]
    used = set()
    needed = set(range(1,10))
    for var in var_list:
        for char in var:
            if int(char) in needed:
                if int(char) in used:
                    return False
                else:
                    needed.remove(int(char))
                    used.add(int(char))
    if len(needed) is 0:
        return True
    else:
        return False

def iterposs(num):
    x = 1
    while len(str(num * x)) < 9 - (len(str(num)) + len(str(x))):
        x += 1
    while len(str(num * x)) < 10 - (len(str(num)) + len(str(x))):
        yield (x,num * x)
        x += 1

data = set()

for x in range(1,2000):
    for y,z in iterposs(x):
        if checkpan([x,y,z]) and z not in [v3 for (v1,v2,v3) in data]:
#        if checkpan([x,y,z]) and (x,z) not in [(v1,v3) for (v1,v2,v3) in data] and (x,z) not in [(v2,v3) for (v1,v2,v3) in data]:
#        if checkpan([x,y,z]):
            print(str(x)+"*"+str(y)+"="+str(z))
            data.add((x,y,z))

answer = 0
for x,y,z in data:
    answer += z
print(answer)